//index.js
//获取应用实例
const app = getApp()

Page({
    data: {
        score: 0,
        tel:''
    },
    onLoad: function () {
        this.getScore();
        this.getTel()
    },
    getScore:function(){
        var that = this;
        wx.showToast({
            title:'加载中',
            icon:'loading'
        })
        app.util.request({
            url:app.globalRequestUrl + '/showjifen',
            method:'GET',
            success:function (res) {
                if(res && res.msg == 'success'){
                    that.setData({
                        score:res.jifen,
                    })
                }
            },
            complete:function () {
                wx.hideToast();
            }
        })
    },
    getTel:function(){
        var that = this;
        wx.showToast({
            title:'加载中',
            icon:'loading'
        })
        app.util.request({
            url:app.globalRequestUrl + '/telservice',
            method:'GET',
            success:function (res) {
                if(res && res.msg == 'success'){
                    that.setData({
                        tel:res.data,
                    })
                }
            },
            complete:function () {
                wx.hideToast();
            }
        })
    },
    bindGetScore:function () {
        wx.showModal({
            title:'提示',
            content:'请拨打客服电话，联系我们提取积分！',
            showCancel:false
        })
    }
})
